<template>
  <div class="login-container">
    <div class="login-body">
      <div class="login-title">测井曲线重构</div>
      <div>
        <el-form :model="loginForm" ref="">
          <el-form-item>
            <el-input type="text" v-model="loginForm.userName" suffix-icon="iconfont icon-user"
                      placeholder="请输入您的账号"></el-input>
          </el-form-item>
          <el-form-item >
            <el-input type="password" v-model="loginForm.userPassword" suffix-icon="iconfont icon-mima"
                      placeholder="请输入您的密码" show-password>

            </el-input>
          </el-form-item>
          <el-form-item>
            <el-button style="
                                margin-top: 15px;
                                width: 100%;


                            " @click="submitForm" type="primary">
              <b style="font-size: 22px;"> 用户登录</b></el-button><br />
            <el-button style="width: 100%; margin-top: 5px" @click="register" :underline="false"
                       type="info">
              <b style="font-size: 22px;"> 注册新账号</b></el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>

  </div>
</template>


<script>

export default {
  name: "login",
  data() {
    const _self = this

    return {
      //控制打开注册模态框
      showRegisterFlag : false,
      //登录表单绑定属性
      loginForm: {
        userName: undefined,
        userPassword: undefined,
      },

    };
  },
  methods: {
    //登录按钮绑定方法
    submitForm() {
      const _self = this
      this.$router.replace("/index");
      // //发送登录请求
      // _self.$http.post("/api/login",_self.loginForm)
      //   .then(function (resp) {
      //     if(resp.data.code==500){
      //       _self.$message.error(resp.data.msg)
      //     }else if(resp.data.code==200){//登录成功,跳转到主页
      //       //将当前登录账号存入sessionStorage
      //       sessionStorage.setItem("username",_self.loginForm.userName)
      //       //将token存入sessionStorage
      //       sessionStorage.setItem("satoken",resp.data.data)
      //       _self.$message.success(resp.data.msg)
      //       _self.$router.replace("/index")
      //     }
      //   })
    },
    register(){
      this.$router.replace("/register");

    }
  }
};
</script>


<style>
@import url('../css/login.css');


</style>
